package com.balance.utils;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @Title: UserIPAddr
 * @Author 小东
 * @Package com.balance.utils
 * @Date 2025/3/28 15:04
 * @description: 获取当前用户的IP
 */
public class UserIPAddrUtil {
    // 获取对象实例
    public static InetAddress getInetAddressInstance() throws UnknownHostException {
        InetAddress localHost = InetAddress.getLocalHost();
        return localHost;
    }

    // 获取IP地址
    public  static  String getIp() throws UnknownHostException {
            return getInetAddressInstance().getHostAddress();
    }
}
